package mao.thinkinjava.array;

import java.util.Random;

public class RandomGenerator {
    public static Random rm = new Random(47);
    public static class Character implements Generator<java.lang.Character>{
        char[] chars = CountingGenerator.Character.chars;//复用了CountingGenerator里面的。
        @Override
        public java.lang.Character generate() {
            return chars[rm.nextInt(chars.length)];
        }
    }

    public static class String extends CountingGenerator.String{
        { cg = new Character(); } //这是父类的成员变量，必须写在初始化块。
        public String(){}
        public String(int length){super(length);}
    }
}
